254d252f852ded153b5138ffcb7e45ad603bbf62,src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPanel.java,RunMessageWindow,run,#,172

Before Change


                            .get(this.contactItem);

                    if (msgWindow.isVisible())
                        msgWindow.toFront();
                    else
                        msgWindow.setVisible(true);
                }

After Change


                            .get(this.contactItem);

                    if (msgWindow.isVisible()) {
                        if(msgWindow.getState() == JFrame.ICONIFIED)
                            msgWindow.setState(JFrame.NORMAL);
                        
                        msgWindow.toFront();
                    }
                    else
                        msgWindow.setVisible(true);
                }
                else {
                    /*
                     * If there's no chat window for the contact create it and
                     * show it.
                     */
                    ChatWindow msgWindow = new ChatWindow(mainFrame);

                    contactMsgWindows.put(this.contactItem, msgWindow);

                    ChatPanel chatPanel = msgWindow.createChat(
                            this.contactItem, contactStatus, protocolContact);

                    chatPanel.loadHistory();

                    msgWindow.addChat(chatPanel);

                    msgWindow.pack();

                    msgWindow.setVisible(true);

                    msgWindow.getCurrentChatPanel().requestFocusInWriteArea();
                }
            }
            else {
                // If in mode "group messages in one chat window"
                if (tabbedChatWindow == null) {
                    // If there's no open chat window
                    tabbedChatWindow = new ChatWindow(mainFrame);

                    tabbedChatWindow.addWindowListener(new WindowAdapter() {
                        public void windowClosing(WindowEvent e)
                        {
                            tabbedChatWindow = null;
                        }
                    });
                }
                /*
                 * Get the hashtable containg all tabs and corresponding chat
                 * panels.
                 */
                Hashtable contactTabsTable = tabbedChatWindow
                        .getContactChatsTable();

                // If there's no open tab for the given contact.
                if (contactTabsTable.get(this.contactItem.getMetaUID()) == null) {
                    ChatPanel chatPanel = tabbedChatWindow.createChat(
                            this.contactItem, contactStatus, protocolContact);

                    chatPanel.loadHistory();

                    tabbedChatWindow.addChatTab(chatPanel);

                    if (tabbedChatWindow.getTabCount() > 1) {
                        tabbedChatWindow
                                .setSelectedContactTab(this.contactItem);
                    }

                    if (tabbedChatWindow.isVisible()) {
                        
                        if(tabbedChatWindow.getState() == JFrame.ICONIFIED)
                            tabbedChatWindow.setState(JFrame.NORMAL);
                        
                        tabbedChatWindow.toFront();
                    }
                    else
                        tabbedChatWindow.setVisible(true);

                    tabbedChatWindow.getCurrentChatPanel()
                            .requestFocusInWriteArea();
                }
                else {
                    // If a tab for the given contact already exists.
                    if (tabbedChatWindow.getTabCount() > 1) {
                        tabbedChatWindow
                                .setSelectedContactTab(this.contactItem);
                    }

                    if (tabbedChatWindow.isVisible()) {
                        
                        if(tabbedChatWindow.getState() == JFrame.ICONIFIED)
                            tabbedChatWindow.setState(JFrame.NORMAL);
                        tabbedChatWindow.toFront();
                    }